Fixed nodeToString() to return valid HTML - #110
Conversation
In some cases the output of nodeToString() is not valid HTML, e.g. for iframe nodes. Solution found here: http://stackoverflow.com/questions/27020950/lxml-modify-tags-prevent An example of bad behavior is an article with a youtube video inside. The video embed code is transformed into `<iframe ... />`, that is not valid, and thus the result in the browser is a page with no visible content after the video.
|
Testing this locally right now, thanks for another good PR @ecesena! |
|
@ecesena Your work is good, it's gonna be a little longer until I merge, currently trying to fix some things on the python-2 branch. |
|
Thank you, no rush on my side - I'll pull req something more complex for the title extraction by the end of the day. |
|
Good job, I'll port these changes to the python-2 branch today as well. I was a bit concerned at first because I thought changing the HTML output that much in
|
|
Great to know that it didn’t take too much effort! I was likewise surprised to discover that <iframe/> is not valid html.
Emanuele Cesena emanuele.cesena@gmail.com Il corpo non ha ideali |
In some cases the output of nodeToString() is not valid HTML, e.g. for iframe nodes.
Solution found here: http://stackoverflow.com/questions/27020950/lxml-modify-tags-prevent
An example of bad behavior is an article with a youtube video inside. The video embed code is transformed into
<iframe ... />, that is not valid, and thus the result in the browser is a page with no visible content after the video.